package research.ui.views.filters;

import java.util.Date;

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

import research.domain.Application;

public class ApplicationDateFilter extends ViewerFilter {
	Date start, finish;

	public ApplicationDateFilter(Date start, Date finish) {
		super();
		this.start = start;
		this.finish = finish;
	}

	public boolean select(Viewer viewer, Object parentElement,
			Object element) {
		if (element instanceof Application) {
			Application res = (Application) element;
			return res.getDate().compareTo(start) >= 0
					&& res.getDate().compareTo(finish) <= 0;
		} else
			return true;
	}

}